package com.livedocumentation.client.web.menu;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Anchor;
import com.livedocumentation.client.model.ProjectClass;
import com.livedocumentation.client.web.MainPage;
import com.livedocumentation.client.web.description.FeaturePanel;

public class AnchorFileName extends Anchor {

	public AnchorFileName(final ProjectClass projectFeature) {

		String featureName = projectFeature.getFeatureName();

		featureName = "<img src='/images/world.gif'> "
				+ projectFeature.getFeatureName();

		this.setHTML(featureName);

		this.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {

				Menu.untoggleLinks();

				MainPage.documentationPanel.clear();

				MainPage.documentationPanel
						.add(new FeaturePanel(projectFeature));
			}
		});
	}
}
